Skip to content

Conversation

@hyongtao-code
Copy link
Contributor

@hyongtao-code hyongtao-code commented Jan 21, 2026

Fix a documentation typo: isasyncgenfunction() applies to asynchronous generator functions, not coroutine functions.

Test python script

import functools
import inspect

async def agen():
    yield 1
    yield 2

print(inspect.isasyncgenfunction(agen))     # output: True
print(inspect.iscoroutinefunction(agen))    # output: Fasle
print(inspect.isgeneratorfunction(agen))    # output: Fasle

class C:
    async def agen2(self):
        yield 1
    
    agen2_pm = functools.partialmethod(agen2)

print(inspect.isasyncgenfunction(C.agen2))  # output: True
print(inspect.iscoroutinefunction(C.agen2)) # output: Fasle
print(inspect.isgeneratorfunction(C.agen2)) # output: Fasle

print(inspect.isasyncgenfunction(C.agen2_pm))  # output: True  <------------------- !!!
print(inspect.iscoroutinefunction(C.agen2_pm)) # output: Fasle
print(inspect.isgeneratorfunction(C.agen2_pm)) # output: Fasle

📚 Documentation preview 📚: https://cpython-previews--144099.org.readthedocs.build/

@bedevere-app bedevere-app bot added docs Documentation in the Doc dir skip news awaiting review labels Jan 21, 2026
@github-project-automation github-project-automation bot moved this to Todo in Docs PRs Jan 21, 2026
@encukou encukou added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Jan 23, 2026
@encukou encukou merged commit f3dd0ca into python:main Jan 23, 2026
42 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Jan 23, 2026
@miss-islington-app
Copy link

Thanks @hyongtao-code for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 23, 2026
…44099)

Fix incorrect reference in isasyncgenfunction docs
(cherry picked from commit f3dd0cae6cea38b15b42b20d39c7142a4a0f716e)

Co-authored-by: Yongtao Huang <yongtaoh2022@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 23, 2026
…44099)

Fix incorrect reference in isasyncgenfunction docs
(cherry picked from commit f3dd0ca)

Co-authored-by: Yongtao Huang <yongtaoh2022@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Jan 23, 2026

GH-144170 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jan 23, 2026
@bedevere-app
Copy link

bedevere-app bot commented Jan 23, 2026

GH-144171 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jan 23, 2026
@hyongtao-code hyongtao-code deleted the fix-doc branch January 23, 2026 08:17
encukou pushed a commit that referenced this pull request Jan 23, 2026
…144099) (GH-144171)

(cherry picked from commit f3dd0ca)

Co-authored-by: Yongtao Huang <yongtaoh2022@gmail.com>
encukou pushed a commit that referenced this pull request Jan 23, 2026
…144099) (GH-144170)

(cherry picked from commit f3dd0ca)

Co-authored-by: Yongtao Huang <yongtaoh2022@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip issue skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants